package com.seckill.common;

import static com.sun.xml.internal.ws.api.message.Packet.State.ServerResponse;

/**
 * 定义通用的HTTP响应对象
 */
public class CommonResponse {
    // 响应状态：success或fail
    private String status;

    // 响应数据：status==success，则返回数据；status==fail，返回错误码
    private Object data;

    // 通用的响应方法
    public static CommonResponse create(Object data, String status) {
        CommonResponse response = new CommonResponse();
        response.setStatus(status);
        response.setData(data);
        return response;
    }

    public static CommonResponse create(Object data) {
        return CommonResponse.create(data, "success");
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
